import Layout from '@/views/layout/app-Layout.vue'
import Vue from 'vue'
import VueRouter from 'vue-router'
import UserLogin from '@/views/login/UserLogin.vue' 
import MenuHome from '@/views/home/APPHome.vue'
//异步
const MenuProduction = () => import('@/views/production/APPProduction.vue')
const MenuProductionList = () => import('@/views/production/list/APPProductList.vue')
const MenuProductionCategory = () => import('@/views/production/category/APPCategory.vue')
const MenuOrder = () => import('@/views/order/OrderIndex.vue')
const MenuOrderCollect = () => import('@/views/order/collect/APPCollect.vue')
const MenuOrderContract = () => import('@/views/order/contract/APPContract.vue')
const MenuOrderList = () => import('@/views/order/list/APPOrderList.vue')
const MenuAdvert = () => import('@/views/advert/APPAdvert.vue')
const MenuAdvertList = () => import('@/views/advert/list/AdvertList.vue')
const MenuSystemManage = () => import('@/views/SystemManage/APPSystemManage.vue')
const MenuSystemManageDepartment = () => import('@/views/SystemManage/department/SystemManageDepartment.vue')
const MenuSystemManageRole = () => import('@/views/SystemManage/role/SystemManageRole.vue')
//懒加载
Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'layout',
        component:Layout,
        children:[
            {
                path: '/',
                name: 'home',
                component:MenuHome
            },
            {
                path: '/production',
                name: 'production',
                component:MenuProduction,
                children:[
                    {
                        path: 'list',
                        name: 'list',
                        component:MenuProductionList,
                    },
                    {
                        path: 'category',
                        name: 'category',
                        component:MenuProductionCategory
                    }
                ]
            },
            {
                path: '/order',
                name: 'order',
                component:MenuOrder,
                children:[
                    {
                        path: 'collect',
                        name: 'collect',
                        component: MenuOrderCollect,
                    },
                    {
                        path: 'contract',
                        name: 'contract',
                        component: MenuOrderContract,
                    },
                    {
                        path: 'list',
                        name: 'list',
                        component: MenuOrderList,
                    }
                ]
            },
            {
                path: '/advert',
                name: 'advert',
                component:MenuAdvert,
                children:[
                    {
                        path: 'list',
                        name: 'list',
                        component: MenuAdvertList,
                    }
                ]
            },
            {
                path: '/SystemManage',
                name: 'SystemManage',
                component:MenuSystemManage,
                children:[
                    {
                        path: 'department',
                        name: 'department',
                        component: MenuSystemManageDepartment,
                    },
                    {
                        path: 'role',
                        name: 'role',
                        component: MenuSystemManageRole,
                    }
                ]
            }
        ]
    },
    {
        path: '/login',
        name: 'login',
        component:UserLogin
    }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router  